﻿namespace Arms.Persistence
{
    using Arms.Domain;
    using System.Collections.Generic;

    /// <summary>
    /// Base class for all repositories
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class RepositoryDescribed<T> : Repository<T>, IRepositoryDescribed<T> where T : EntityDescribed
    {
        public RepositoryDescribed(IDbContext context) : base(context) { }

        /// <summary>
        /// Collection of entities by its name.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public IEnumerable<T> GetByName(string name)
        {
            return base.Get(x => x.Name == name);
        }
    }
}
